import java.util.concurrent.CountDownLatch;

/**
 * @program: thread
 * @ClassName T00_IPlusPlus
 * @description:
 * @author: yaoguipei
 * @create: 2021-08-11 21:14
 * @Version 1.0
 **/
public class T00_IPlusPlus {
    private static long n = 0L;


    public static void main(String[] args) throws Exception {
        Thread[] threads = new Thread[100];
        CountDownLatch latch = new CountDownLatch(threads.length);
        long start = System.currentTimeMillis();
        for (int i = 0; i < threads.length; i++) {
            threads[i] = new Thread(() -> {
                for (int j = 0; j < 10000; j++) {
                    //synchronized (T00_IPlusPlus.class) {
                    n++;
                    //}
                }
                latch.countDown();
            });
        }

        for (Thread t : threads) {
            t.start();
        }

        latch.await();
        System.out.println(System.currentTimeMillis()-start);
        System.out.println(n);

    }

}
